package com.example.demo;

import lombok.val;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class RedisDemo {
    public static void test1(Jedis jedis){
        System.out.println("set and get");
        jedis.set("key","111");
        jedis.set("key2","222");
        String val1 = jedis.get("key");
        String val2 = jedis.get("key2");
        System.out.println("val1: "+val1+";val2:"+val2);
    }
     public static void main(String[] args) {
         JedisPool jedisPool = new JedisPool("tcp://127.0.0.1:9999");//只有开发阶段这样写，实际开发中要改变
         try(Jedis jedis = jedisPool.getResource()){
//             String pong = jedis.ping();
//             System.out.println(pong);
             test1(jedis);
         }
    }
}
